package com.tedu.m1;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/11/26
 */
public class Producer {

    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory c= new ConnectionFactory();
        c.setHost("192.168.126.129");
        c.setPort(5672);
        c.setUsername("admin");
        c.setPassword("admin");
        Connection connection = c.newConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare("helloword",false,false,false,null);
        channel.basicPublish("", "helloword", null, "aaaaaaaaaaaaaaaaaaaaa".getBytes());

    }
}
